package ${package}.model;

import com.ishansong.common.json.Jsoner;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.io.Serializable;

/**
 * 订单基本信息
 */
@Entity
@Table(name="orders")
public class Order implements Serializable {

    private static final long serialVersionUID = 5304591677762217757L;

    /**
     * 主键id
     */
    private Long id;

    /**
     * 下单人
     */
    private Long userId;

    /**
     * 城市id *
     */
    private Long cityId;

    /**
     * 优惠券
     */
    private Long couponId;

    /**
     * 冗余闪送员ID
     */
    private Long courierId;

    /**
     * 订单号码
     */
    private String orderNumber;

    /**
     * 订单使用的优惠券号码
     */
    private String couponNumber;

    /**
     * 批量下单用
     */
    private String batchOrderNumber;

    /**
     * 城市(冗余)
     */
    private String city;

    /**
     * 订单来源
     * @see ${package}.enums.OrderChannel
     */
    private Integer channel;
    /**
     * 业务类型
     * @see ${package}.enums.BussinessType
     */
    private Integer bussinessType;
    /**
     * 订单类型
     * @see ${package}.enums.OrderType
     */
    private Integer type;

    /**
     * 订单状态
     * @see ${package}.enums.OrderStatus
     */
    private Integer status;

    /**
     * 距离 单位：米
     */
    private Integer distance;

    /**
     * 重量 单位：kg
     */
    private Integer weight;

    /**
     * 客户要求交通工具
     */
    private Integer travelWay;

    /**
     * 闪送员派送时的交通工具
     */
    private Integer courierTravelWay;

    /**
     * 客户备注
     */
    private String remark;

    /**
     * 是否并单
     */
    private Boolean isMerge;

    /**
     * 是否上报异常
     */
    private Boolean abnormal;

    /**
     * 上报取消
     */
    private Boolean cancelled;

    /**
     * 预约类型
     * @see ${package}.enums.AppointType
     */
    private Integer appointType;

    /**
     * 客服备注
     */
    private String adminRemark;

    /**
     * 派送类型
     * @see ${package}.enums.DispatchType
     */
    private Integer dispatchType;

    /**
     * 推送次数 (冗余)
     */
    private Integer pushTimes;

    /**
     * 订单创建时间
     */
    private Long ctime;

    /**
     * 成单时间
     * 在线支付／寄付／到付 时间
     */
    private Long placeTime;

    /**
     * 所有订单都完成的时间
     */
    private Long finishTime;

    /**
     * 订单类别（包括普通，保温箱，鲜花，蛋糕等）
     * @see ${package}.enums.OrderCategory
     */
    private Integer category;

    @Id
    @GeneratedValue(generator = "orders_seq")
    @GenericGenerator(name = "orders_seq",
            strategy = "com.matrixjoy.dal.id.util.IdGenerator",
            parameters = { @org.hibernate.annotations.Parameter(name = "sequence", value = "orders_seq") })
    @Column(name="id")
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Column(name="user_id")
    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    @Column(name="city_id")
    public Long getCityId() {
        return cityId;
    }

    public void setCityId(Long cityId) {
        this.cityId = cityId;
    }

    @Column(name="coupon_id")
    public Long getCouponId() {
        return couponId;
    }

    public void setCouponId(Long couponId) {
        this.couponId = couponId;
    }

    @Column(name="courier_id")
    public Long getCourierId() {
        return courierId;
    }

    public void setCourierId(Long courierId) {
        this.courierId = courierId;
    }

    @Column(name="order_number")
    public String getOrderNumber() {
        return orderNumber;
    }

    public void setOrderNumber(String orderNumber) {
        this.orderNumber = orderNumber;
    }

    @Column(name="coupon_number")
    public String getCouponNumber() {
        return couponNumber;
    }

    public void setCouponNumber(String couponNumber) {
        this.couponNumber = couponNumber;
    }

    @Column(name = "batch_order_number")
    public String getBatchOrderNumber() {
        return batchOrderNumber;
    }

    public void setBatchOrderNumber(String batchOrderNumber) {
        this.batchOrderNumber = batchOrderNumber;
    }

    @Column(name="city")
    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    @Column(name="channel")
    public Integer getChannel() {
        return channel;
    }

    public void setChannel(Integer channel) {
        this.channel = channel;
    }

    @Column(name="type")
    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {

        this.type = type;
    }
    @Column(name="bussiness_type")
    public Integer getBussinessType() {
        return bussinessType;
    }

    public void setBussinessType(Integer bussinessType) {
        this.bussinessType = bussinessType;
    }

    @Column(name="appoint_type")
    public Integer getAppointType() {
        return appointType;
    }

    public void setAppointType(Integer appointType) {
        this.appointType = appointType;
    }

    @Column(name="status")
    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Column(name="distance")
    public Integer getDistance() {
        return distance;
    }

    public void setDistance(Integer distance) {
        this.distance = distance;
    }

    @Column(name="weight")
    public Integer getWeight() {
        return weight;
    }

    public void setWeight(Integer weight) {
        this.weight = weight;
    }

    @Column(name="travel_way")
    public Integer getTravelWay() {
        return travelWay;
    }

    public void setTravelWay(Integer travelWay) {
        this.travelWay = travelWay;
    }

    @Column(name="courier_travel_way")
    public Integer getCourierTravelWay() {
        return courierTravelWay;
    }

    public void setCourierTravelWay(Integer courierTravelWay) {
        this.courierTravelWay = courierTravelWay;
    }

    @Column(name="remark")
    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    @Column(name="is_merge")
    public Boolean getIsMerge() {
        return isMerge;
    }

    public void setIsMerge(Boolean isMerge) {
        this.isMerge = isMerge;
    }

    @Column(name="abnormal")
    public Boolean getAbnormal() {
        return abnormal;
    }

    public void setAbnormal(Boolean abnormal) {
        this.abnormal = abnormal;
    }

    @Column(name="cancelled")
    public Boolean getCancelled() {
        return cancelled;
    }

    public void setCancelled(Boolean cancelled) {
        this.cancelled = cancelled;
    }

    @Column(name="admin_remark")
    public String getAdminRemark() {
        return adminRemark;
    }

    public void setAdminRemark(String adminRemark) {
        this.adminRemark = adminRemark;
    }

    @Column(name="push_times")
    public Integer getPushTimes() {
        return pushTimes;
    }

    public void setPushTimes(Integer pushTimes) {
        this.pushTimes = pushTimes;
    }

    @Column(name="ctime")
    public Long getCtime() {
        return ctime;
    }

    public void setCtime(Long ctime) {
        this.ctime = ctime;
    }

    @Column(name="place_time")
    public Long getPlaceTime() {
        return placeTime;
    }

    public void setPlaceTime(Long placeTime) {
        this.placeTime = placeTime;
    }

    @Column(name="finish_time")
    public Long getFinishTime() {
        return finishTime;
    }

    public void setFinishTime(Long finishTime) {
        this.finishTime = finishTime;
    }

    @Column(name="dispatch_type")
    public Integer getDispatchType() {
        return dispatchType;
    }

    public void setDispatchType(Integer dispatchType) {
        this.dispatchType = dispatchType;
    }

    @Column(name="category")
    public Integer getCategory() {
        return category;
    }

    public void setCategory(Integer category) {
        this.category = category;
    }

    @Override
    public String toString() {
        //统计日志需要json格式，请不要随便更改
        return Jsoner.DEFAULT.toJson(this);
    }
}
